﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShopCar.aspx.cs" Inherits="MembershipCard_wechat_web_ShopCar" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"
        name="viewport" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link type="text/css" href="css/index.css" rel="stylesheet" />
    <title>购物车</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="indexmenu">
       <ul>
       <li><span><a href="javascript:history.go(-1);"><em class="indexicon1"></em></a></span></li>
        <li><span><a href="Products.aspx"><em class="indexicon2"></em></a></span></li>
         <li><span><a href="shouhuo.aspx"><em class="indexicon3"></em></a></span></li>
          <li runat="server" id="sumcar"><span><a href="ShopCar.aspx"><em class="indexicon4"></em></a></span></li>
    </ul>
    </div>
    <div class="order">
        <div id="allcheck" runat="server">
            <%--<div class="order_pin">
                <p>
                    <a href="#">
                        <img src="images/chan1.png" /></a><span>玉容眼霜 15g</span> <span>数量：<bdo>1</bdo> 积分：<bdo>100分</bdo></span>
                </p>
                <div class="zongji">
                    <span>数量：<input name="aa" type="text" value="1" size="3" class="input" />
                        &nbsp;共计：<bdo>265分</bdo></span><label><input name="" type="checkbox" value="" class="dropdown-checkbox"
                            onclick="javascript:checks(this);" /></label></div>
            </div>
            <div class="order_pin">
                <p>
                    <a href="#">
                        <img src="images/chan1.png" /></a><span>玉容眼霜 15g</span> <span>数量：<bdo>1</bdo> 积分：<bdo>100分</bdo></span>
                </p>
                <div class="zongji">
                    <span>数量：<input name="aa" type="text" onchange="textchange(id,this.value)" value="1" size="3" class="input" />
                        &nbsp;共计：<bdo>265分</bdo></span><label><input name="" type="checkbox" value="" class="dropdown-checkbox"
                            onclick="javascript:checks(this);" /></label></div>
            </div>--%>
        </div>
        <div class="carbox" runat="server" id="js">
            <div class="carbtn" id="carbtn" style="display: none;">
                <ol>
                    <div class="goubtn curbg">
                        在线支付</div>
                    <input type="hidden" value="在线支付" />
                </ol>
                <ol>
                    <div class="goubtn">
                        货到付款</div>
                    <input type="hidden" value="货到付款" />
                </ol>
            </div>
            <div class="zongji">
                <span class="jiesuanbtn" onclick="js()">去结算</span> <i style="padding-top: 10px; font-style: normal;
                    float: left;">
                    <label>
                        <input name="" type="checkbox" checked="checked" value="" class="dropdown-checkbox checkboxcur" onclick="javascript:allcheck(this);" /></label>
                    全选 &nbsp; 共计：<bdo runat="server" id="sumfen">0分</bdo></i></div>
        </div>
    </div>
    <input type="hidden" runat="server" id="carid" />
    <input type="hidden" runat="server" id="carnum" />
       <asp:Button ID="Button1" class="btn" Width="100%" Style="display: none;" runat="server"
                Text="修改购物车数量" OnClick="Button1_Click" />
    </form>
</body>
</html>
<script type="text/javascript">
    var carol = document.getElementById('carbtn').getElementsByTagName('ol');
    for (var i = 0; i < carol.length; i++) {
        carol[i].onclick = function () {
            for (var i = 0; i < carol.length; i++) {
                carol[i].children[0].className = 'goubtn';
            }
            this.children[0].className = 'goubtn curbg';
        }
    }
    var flag = true;
    function checks(ob) {
        if (flag == false) {
            ob.className = 'dropdown-checkbox checkboxcur';
            flag = true;
        } else {
            ob.className = 'dropdown-checkbox';
            flag = false;
        }
        sumfen();
    }
    function sumfen() {
        var allcheckbox = document.getElementById('allcheck').getElementsByTagName('label');
        var fen = 0;
        for (var i = 0; i < allcheckbox.length; i++) {
            if (allcheckbox[i].children[0].checked == true) {
                fen += Number(allcheckbox[i].children[0].name);
            }
        }
        document.getElementById("sumfen").innerHTML = fen + "分";
    }

    function allcheck(obj) {
        var allcheckbox = document.getElementById('allcheck').getElementsByTagName('label');

        if (flag == false) {
            obj.className = 'dropdown-checkbox checkboxcur';
            for (var i = 0; i < allcheckbox.length; i++) {
                allcheckbox[i].children[0].className = 'dropdown-checkbox checkboxcur';
                allcheckbox[i].children[0].checked = true;
            }
            flag = true;
        } else {
            obj.className = 'dropdown-checkbox';
            for (var i = 0; i < allcheckbox.length; i++) {
                allcheckbox[i].children[0].className = 'dropdown-checkbox';
                allcheckbox[i].children[0].checked = false;
            }
            flag = false;
        }
        sumfen();
    }

    function js() {
        var ids = "";
        var allcheckbox = document.getElementById('allcheck').getElementsByTagName('label');
        for (var i = 0; i < allcheckbox.length; i++) {
            if (allcheckbox[i].children[0].checked == true) {
                ids += allcheckbox[i].children[0].value + ",";
            }
            if (ids == "") {
                alert("请选择需要结算的商品");
                return;
            }
            location = "Order.aspx?ids=" + ids;
        }
    }

    function sc(id) {
        if (confirm("是否确定删除?")) {
            location = "ShopCar.aspx?sid=" + id;
            return true;
        }
        return false;
    }

    function textchange(id, value) {
        document.getElementById("carid").value = id;
        document.getElementById("carnum").value = value;
        document.getElementById("Button1").click();
    }
</script>
